<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ingreso de Materias</title>
<link rel="stylesheet" href="<c:url value='/css/estilos.css'/>" />

</head>
<body>
	<header> <jsp:include page="items.jsp"></jsp:include> </header>
	<div style="margin: auto; width: 80%;">
		<h1 style="width: 100%; text-align: center;">Administraci&oacuten
			de Materias</h1>

		<c:url var="addUrl" value="/subject/add" />

		<table style="border: 1px solid; width: 100%; text-align: center">
			<thead style="background: #ff0000; color: #ffffff">
				<tr>
					<th>C&oacute;digo</th>
					<th>Nombre</th>
					<th>Nombre del Profesor</th>
					<th>Periodo</th>
					<th colspan="4">Opciones</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${subjects}" var="subject">
					<c:url var="editUrl"
						value="/subject/edit?id=${subject.subjectCode}" />
					<c:url var="deleteUrl"
						value="/subject/delete?id=${subject.subjectCode}" />
					<c:url var="detailUrl"
						value="/subjectdetail/manage?id=${subject.subjectCode}" />
					<c:url var="addNotificationUrl"
						value="/notification/add?subjectCode=${subject.subjectCode}&id=${currentUserCode}" />
					<tr>
						<td><c:out value="${subject.subjectCode}" /></td>
						<td><c:out value="${subject.subjectName}" /></td>
						<td><c:out value="${subject.teacherName}" /></td>
						<td>
						<c:choose>
						<c:when test="${subject.subjectPeriod == 1}">Diario</c:when>
						<c:when test="${subject.subjectPeriod == 2}">Semanal</c:when>
						<c:when test="${subject.subjectPeriod == 3}">Mensual</c:when>
						<c:when test="${subject.subjectPeriod == 4}">Semestral</c:when>
						<c:when test="${subject.subjectPeriod == 5}">Anual</c:when>
						</c:choose>
						</td>
						<td><a href="${editUrl}">Editar</a></td>
						<td><a href="${deleteUrl}"
							onclick="return confirm('Se eliminaran tambien los detalles, desea continuar?');">Eliminar</a></td>
						<td><a href="${detailUrl}">Detalles</a></td>
						<td><a href="${addNotificationUrl}">Crear
								Notificaci&oacuten</a></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>

		<a href="${addUrl}" style="float: right; margin-top: 20px;">Adicionar
			Materia</a>

	</div>
</body>
</html>